export function formatNumber(num) {
  return num.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
}

export function currencyFormatter(amount) {
  // console.log(amount)
  if(amount ===undefined ){
    return '0.00'
  }
  if(amount === '-' || amount === null || amount==='null'){
    return '-'
  }
  const str = String(amount).trim();
  const parts = str.split(".");
  let integerPart = parts[0];
  integerPart = integerPart.replace(/\B(?=(\d{3})+(?!\d))/g, ",");

  if (parts.length > 1) {
    const decimalPart = parts[1].substring(0, 2);
    return integerPart + "." + decimalPart;
  }

  return integerPart + ".00";
}
